<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        .layui-tab-title li button {
            width: 100px;
            margin-bottom: 30px;
        }

        .layui-this {
            background: #f2f2f2
        }
        .bggroudff{
            background-color:#fafafa;
        }
    </style>
</head>
<body>
<div class="layui-tab layui-tab-card" lay-filter="test" style="float: left;width: 100%;">
    <ul class="layui-tab-title" style="float:left;">
        <li class="layui-this" lay-id="11" style="background: #f2f2f2">
            <button type="button" class="layui-btn" style="float:left;margin-top: 100px">销售收入</button>
        </li>
        <br>
        <li lay-id="22" style="background: #f2f2f2">
            <button type="button" class="layui-btn" style="float:left;">采购费用</button>
        </li>
        <br>
        <li lay-id="33" style="background: #f2f2f2">
            <button type="button" class="layui-btn" style="float:left;">固定资产</button>
        </li>
        <br>
        <li lay-id="44" style="background: #f2f2f2">
            <button type="button" class="layui-btn" style="float:left;">财务报表</button>
        </li>
        <br>
    </ul>
    <div class="layui-tab-content" style="width: 80%;margin-left: 10%;">
        <div class="layui-tab-item layui-show">

            <hr>
            <div class="layuimini-container">
                <div id="test-1" style="width: 13%;float: left;margin-top: 20px;margin-left: 20px"></div>
                <div class="layuimini-main">
                    <div>
                        <table id="demo_1" lay-filter="demo_1"></table>
                    </div>
                </div>
            </div>
            <div class="layui-row layui-col-space15"style="margin-top: 10px;margin-bottom: 10px" >
                <div class="layui-col-md6" style="width: 100%"style="float: left">
                    <div class="layui-panel">
                        <div style="padding: 30px;width: 100% ;margin: auto">
                            <div class="layui-form" style="float: left">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">查询日期</label>
                                    <div class="layui-inline">
                                        <input type="text" class="layui-input" id="rqi_1" placeholder="开始日期">
                                    </div>
                                    <div class="layui-inline">
                                        <input type="text" class="layui-input" id="rqi_2" placeholder="结束日期">
                                    </div>
                                </div>
                            </div>
                            <button type="button" class="layui-btn layui-btn-primary layui-border-green" id="but_1"
                                    style="width: 100px;height: 40px;background: #f2f2f2;margin-right: 210px">查询
                            </button>
                            [<span id="mx"></span>]明细
                        </div>
                    </div>
                </div>
            </div>
            <div class="layuimini-container">
                <div id="test-2" style="width: 13%;float: left;margin-top: 20px;margin-left: 20px"></div>
                <div class="layuimini-main">
                    <div>
                        <table id="demo_2" lay-filter="test"></table>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-tab-item">
            <div class="layui-tab-item layui-show">
                <div class="layuimini-container" style="margin-top: 10px;margin-bottom: 10px">
                    <div class="layuimini-main">
                        <div>
                            <table id="demo_3" lay-filter="demo_3"></table>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item layui-show">
                    <div class="layui-row layui-col-space15">
                        <div class="layui-col-md6" style="width: 100%">
                            <div class="layui-panel">
                                <div style="padding: 30px;width: 100%">
                                    <div class="layui-form" style="float: left">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">查询日期</label>
                                            <div class="layui-inline">
                                                <input type="text" class="layui-input test-item" id="rqi_3" placeholder="开始日期">
                                            </div>
                                            <div class="layui-inline">
                                                <input type="text" class="layui-input test-item" id="rqi_4" placeholder="结束日期">
                                            </div>
                                        </div>
                                    </div>
                                    <button type="button" class="layui-btn layui-btn-primary layui-border-green" id="but_2"
                                            style="width: 100px;height: 40px;background: #f2f2f2">查询
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layuimini-container" style="margin-top: 10px;margin-bottom: 10px">
                        <div class="layuimini-main">
                            <div>
                                <table id="demo_4" lay-filter="test"></table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-tab-item">
            <div class="layui-tab-item layui-show">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-md6" style="width: 100%">
                        <div class="layui-panel">
                            <div style="padding: 30px;width: 100%">
                                <div style="float: left">
                                    <button type="button" class="layui-btn layui-btn-primary layui-border-green"
                                            style="width: 100px;height: 40px;background: #f2f2f2;margin-left: 40px"  onclick="insertform()";>
                                        资产增加
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-primary layui-border-green"
                                            style="width: 100px;height: 40px;background: #f2f2f2;" ; onclick="reduceform()">资产减少
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-primary layui-border-green"
                                            style="width: 100px;height: 40px;background: #f2f2f2;" ;>期初金额
                                    </button>
                                    <button type="button" class="layui-btn layui-btn-primary layui-border-green"
                                            style="width: 100px;height: 40px;background: #f2f2f2;" ;>打印
                                    </button>
                                </div>
                                <div class="layui-form" style="float: left">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">查询日期</label>
                                        <div class="layui-inline">
                                            <input type="text" class="layui-input test-item" id="rqi_5" placeholder="开始日期">
                                        </div>
                                        <div class="layui-inline">
                                            <input type="text" class="layui-input test-item" id="rqi_6" placeholder="结束日期">
                                        </div>
                                    </div>
                                </div>
                                <button type="button" class="layui-btn layui-btn-primary layui-border-green" id="but_3"
                                        style="width: 100px;height: 40px;background: #f2f2f2">查询
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layuimini-container" style="margin-top: 10px;margin-bottom: 10px">
                    <div class="layuimini-main">
                        <div>
                            <table id="demo_5" lay-filter="test"></table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-tab-item">

            <div class="layui-tab layui-tab-card">
                <ul class="layui-tab-title">
                    <li class="layui-this">应收应付表</li>
                    <li>经营情况表</li>
                    <li>资产负债表</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <div class="layuimini-container" style="margin-top: 10px;margin-bottom: 10px">
                            <div class="layuimini-main">
                                <div>
                                    <table id="demo_6" lay-filter="test"></table>
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item layui-show">
                            <div class="layui-row layui-col-space15">
                                <div class="layui-col-md6" style="width: 100%">
                                    <div class="layui-panel">
                                        <div style="padding: 30px;width: 100%">
                                            <div class="layui-form" style="width:550px;float: left">
                                                <div class="layui-form-item">
                                                    <label class="layui-form-label">查询日期</label>
                                                    <div class="layui-inline">
                                                        <input type="text" class="layui-input test-item" id="rqi_7"
                                                               placeholder="开始日期">
                                                    </div>
                                                    <div class="layui-inline">
                                                        <input type="text" class="layui-input test-item" id="rqi_8"
                                                               placeholder="结束日期">
                                                    </div>
                                                </div>
                                            </div>
                                            <button type="button" class="layui-btn layui-btn-primary layui-border-green" id="but_4"
                                                    style="width: 100px;height: 40px;background: #f2f2f2">查询
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-tab-item layui-show">
                                <div class="layuimini-container" style="margin-top: 10px;margin-bottom: 10px">
                                    <div class="layuimini-main">
                                        <div>
                                            <table id="demo_7" lay-filter="test"></table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-row layui-col-space15">
                            <div class="layui-col-md6" style="width: 100%">
                                <div class="layui-panel">
                                    <div style="padding: 30px;width: 100%">
                                        <div class="layui-form" style="width:550px;float: left">
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">查询日期</label>
                                                <div class="layui-inline">
                                                    <input type="text" class="layui-input test-item" id="rqi_9"
                                                           placeholder="开始日期">
                                                </div>
                                                <div class="layui-inline">
                                                    <input type="text" class="layui-input test-item" id="rqi_10"
                                                           placeholder="结束日期">
                                                </div>
                                            </div>
                                        </div>
                                        <button type="button" class="layui-btn layui-btn-primary layui-border-green" id="but_5"
                                                style="width: 100px;height: 40px;background: #f2f2f2">查询
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layuimini-container" style="margin-top: 10px;margin-bottom: 10px">
                            <div class="layuimini-main">
                                <div>
                                    <table id="demo_8" lay-filter="test"></table>
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item layui-show">
                            <div class="layui-row layui-col-space15">
                                <div class="layui-col-md6"style="width: 100%">
                                    <div class="layui-panel">
                                        <div style="padding: 30px;width: 100%"><div style="margin: auto;width: 100px">经营明细表</div></div>
                                    </div>
                                </div>
                            </div>
                            <div class="layuimini-container" style="margin-top: 10px;margin-bottom: 10px">
                                <div class="layuimini-main">
                                    <div>
                                        <table id="demo_9" lay-filter="test"></table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-row layui-col-space15">
                            <div class="layui-col-md6" style="width: 100%">
                                <div class="layui-panel">
                                    <div style="padding: 30px;width: 100%">
                                        <div class="layui-form" style="width:550px;float: left">
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">统计日期</label>
                                                <div class="layui-inline">
                                                    <input type="text" class="layui-input test-item" id="rqi_11"
                                                           placeholder="开始日期">
                                                </div>
                                                <div class="layui-inline">
                                                    <input type="text" class="layui-input test-item" id="rqi_12"
                                                           placeholder="结束日期">
                                                </div>
                                            </div>
                                        </div>
                                        <button type="button" class="layui-btn layui-btn-primary layui-border-green" id="but_6"
                                                style="width: 100px;height: 40px;background: #f2f2f2">查询
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layuimini-container" style="margin-top: 10px;margin-bottom: 10px">
                            <div class="layuimini-main">
                                <div>
                                    <table id="demo_10" lay-filter="test"></table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<form class="layui-form" action="" lay-filter="form-insert" id="form-insert"style="margin-bottom: 40px;display: none">
    <div class="layui-inline" style="margin: 20px">
        <label class="layui-form-label">科目名称:</label>
        <div class="layui-inline" style="width: 235px;">
            <input name="accName" id="accName" placeholder="科目名称" class="layui-input">
        </div>
    </div>

    <div class="layui-inline"style="margin: 20px">
        <label class="layui-form-label" id="zj">增加的资金:</label>
        <div class="layui-input-inline">
            <input type="tel" id="capital" name="capital" autocomplete="off" class="layui-input">
        </div>
    </div>
</form>

<!--<form class="layui-form" action="" lay-filter="form-reduce" id="form-reduce"style="margin-bottom: 40px;display: none">-->
<!--<div class="layui-inline" style="margin: 20px">-->
<!--<label class="layui-form-label">科目名称:</label>-->
<!--<div class="layui-inline" style="width: 235px;">-->
<!--<input name="accName" id="accName2" placeholder="科目名称" class="layui-input" id="demo3">-->
<!--</div>-->
<!--</div>-->

<!--<div class="layui-inline"style="margin: 20px">-->
<!--<label class="layui-form-label">增加的资金:</label>-->
<!--<div class="layui-input-inline">-->
<!--<input type="tel" name="capital"  autocomplete="off" class="layui-input">-->
<!--</div>-->
<!--</div>-->
<!--</form>-->

<!--15869720053-->
<script src="../../js/jquery-3.6.0.min.js"></script>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['table','laydate','element','dropdown'], function () {
        var dropdown = layui.dropdown
            ,util = layui.util
            ,layer = layui.layer
            ,table = layui.table
            ,$ = layui.jquery;
        dropdown.render({
            elem: '#accName'
            ,data: [{
                title: '工行账号'
                ,id: 101
            },{
                title: '建行银行'
                ,id: 102
            },{
                title: '银联刷卡'
                ,id: 103
            },{
                title: '支付宝'
                ,id: 104
            }]
            ,click: function(obj){
                this.elem.val(obj.title);
            }
            ,style: 'width: 235px;'
        });
        var table = layui.table;
        table.render({
            elem: '#demo_1'
            , url: '/finance'
            , cols: [[
                {field:'empName',title:'',hide:true},
                {field: 'accName', title: '科目名称'},
                {field: 'advPayMoney', title: '费用/收入'},
                {field: 'advPayComment', title: '附加说明'}
            ]]
        });
        table.render({
            elem: '#demo_2'
            , url: '/empl'
            , cols: [[
                {field:'salOrdId',title:'单据号'},
                {field: 'advPayDate', title: '日期'
                    ,templet:"<div>{{layui.util.toDateString(d.advPayDate, 'yyyy-MM-dd')}}</div>"},
                {field: 'salOrdReceivable', title: '金额'},
                {field: 'empName', title: '经办人'},
                {field: 'empName', title: '操作员'},
                {field: 'advPayComment', title: '备注'}
            ]]
        });
        table.render({
            elem: '#demo_3'
            , url: '/finance'
            , cols: [[
                {field:'accId',hide:true,title:'id'},
                {field: 'accName', title: '科目名称'},
                {field: 'advPayMoney', title: '累计金额'},
                {field: 'advPayComment', title: '附加说明'}
            ]]
        });
        table.render({
            elem: '#demo_4'
            , url: '/bank'
            , cols: [[
                {field: 'purStoId', title: '单据号'},
                {field: 'purStoDate', title: '日期',
                    templet:"<div>{{layui.util.toDateString(d.advPayDate, 'yyyy-MM-dd')}}</div>"},
                {field: 'advType', title: '单据类型'},
                {field: 'purStoPayable', title: '金额'},
                {field: 'empName', title: '经办人'},
                {field: 'supName', title: '供货商/客户'},
                {field: 'advPayComment', title: '备注'}
            ]]
        });

        table.render({
            elem: '#demo_5'
            , url: '/finance'
            , cols: [[
                {field: 'accName', title: '科目'},
                {field: 'advPayMoney', title: '金额'},
                {field: 'empName', title: '经办人'},
                {field: 'advPayComment', title: '附加说明'}
            ]]
        });
        table.render({
            elem: '#demo_6'
            , url: '/ghs'
            , cols: [[
                {field: 'supName', title: '往来单位'},
                {field: 'supType', title: '单位类型'},
                {field: 'salOrdPaidIn', title: '我方应收金额',
                    templet:function (obj) {
                        if (obj.salOrdPaidIn==null){
                            obj.salOrdPaidIn="0.00";
                            return obj.salOrdPaidIn;
                        }
                        return obj.salOrdPaidIn
                    }},
                {field: 'purStoOutof', title: '我方应付金额',
                    templet:function (obj) {
                        if (obj.purStoOutof == null) {
                            obj.purStoOutof = "0.00";
                            return obj.purStoOutof;
                        }
                        return obj.purStoOutof
                    }}
            ]]
        });
        table.render({
            elem: '#demo_7'
            , url: '/adv'
            , cols: [[
                {field: 'advPayDate', title: '日期',
                    templet:"<div>{{layui.util.toDateString(d.advPayDate, 'yyyy-MM-dd')}}</div>"},
                {field: 'advPayId', title: '单号'},
                {field: 'commodityCode', title: '内容摘要'},
                {field: 'advPayMoney', title: '应付金额'},
                {field: 'advPayMoney', title: '实付金额'},
                {field: 'empName', title: '操作员'},
                {field: 'empName', title: '经办人'},
                {field: 'commodityCode', title: '备注'}
            ]]
        });
        table.render({
            elem: '#demo_8'
            , url: '/finance'
            , cols: [[
                {field: 'accName', title: '科目名称'},
                {field: 'advPayMoney', title: '发生金额'},
                {field: 'advPayMoney', title: '积累金额'}
            ]]
        });
        table.render({
            elem: '#demo_9'
            , url: '/adv'
            , cols: [[
                {field: 'advPayDate', title: '日期',
                    templet:"<div>{{layui.util.toDateString(d.advPayDate, 'yyyy-MM-dd')}}</div>"},
                {field: 'commodityName', title: '说明'},
                {field: 'advPayMoney', title: '金额'},
                {field: 'empName', title: '经办人'},
                {field: 'commodityCode', title: '备注'}
            ]]
        });
        table.render({
            elem: '#demo_10'
            , url: '/finance'
            , cols: [[
                {field: 'accName', title: '科目名称'},
                {field: 'advPayMoney', title: '期末金额'}
            ]]
        });
        var laydate = layui.laydate;
        laydate.render({
            elem: '#rqi_1'
        });
        laydate.render({
            elem: '#rqi_2'
        });
        table.on('row(demo_1)',function (obj) {

            $("#mx").html(obj.data.accName)
            obj.tr.addClass("bggroudff").siblings().removeClass("bggroudff");
            empName=obj.data.empName

        });
        $("#but_1").click(function () {
            var start= $("#rqi_1").val()
            var end= $("#rqi_2").val()
            table.reload('demo_2',{
                where:{
                    empName:empName,
                    start:start,
                    end:end
                }
            })
        })
        laydate.render({
            elem: '#rqi_3'
        });
        laydate.render({
            elem: '#rqi_4'
        });
        table.on('row(demo_3)',function(obj) {
            obj.tr.addClass("bggroudff").siblings().removeClass("bggroudff");
            empName=obj.data.empName
        })
        $("#but_2").click(function () {
            var start= $("#rqi_3").val()
            var end= $("#rqi_4").val()
            table.reload('demo_4',{
                url:"/bank",
                where:{
                    empName:empName,
                    start:start,
                    end:end
                }
            })
        });

        laydate.render({
            elem: '#rqi_5',
            done:function (value, date, endDate) {
            }
        });
        laydate.render({
            elem: '#rqi_6'
        });
        laydate.render({
            elem: '#rqi_7'
        });
        laydate.render({
            elem: '#rqi_8'
        });
        laydate.render({
            elem: '#rqi_9'
        });
        laydate.render({
            elem: '#rqi_10'
        });
        laydate.render({
            elem: '#rqi_11'
        });
        laydate.render({
            elem: '#rqi_12'
        });
    })
    function insertform() {
        $("#zj").html("增加的资金:")
        layui.use('form', function () {
            var table = layui.table,
                form = layui.form;
            layer.open({
                type: 1,
                title: "资金增加",
                area: ['40%', '40%'],
                content: $("#form-insert"),
                btn: "保存",
                yes: function (obj) {
                    var accName=$("#accName").val();
                    var capital=$("#capital").val();
                    table.reload('demo_5', {
                        url:"/insertbank",
                        where: {
                            accName:accName,
                            capital:capital
                        }
                    })
                    layer.close(layer.index)
                },
                end: function (res) {
                    $("#form-insert").css("display", "none")
                }
            });
        })
    }
    function reduceform() {
        $("#zj").html("减少的资金:")
        layui.use('form', function () {
            var table = layui.table,
                form = layui.form;
            layer.open({
                type: 1,
                title: "资金减少",
                area: ['40%', '40%'],
                content: $("#form-insert"),
                btn: "保存",
                yes: function (obj) {
                    var accName=$("#accName").val();
                    var capital=$("#capital").val();
                    table.reload('demo_5', {
                        url:"/reducebank",
                        where: {
                            accName:accName,
                            capital:capital
                        }
                    })
                    layer.close(layer.index)
                },
                end: function (res) {
                    $("#form-insert").css("display", "none")
                }
            });
        })
    }

</script>
</body>
</html>